#include <iostream>
#include <unistd.h>
#include <pthread.h>

using namespace std;

void *threadRun(void *args) 
{
    while(1) {
        cout << "new thread: " << getpid() << endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, NULL, threadRun, NULL);
    while(1) {
        cout << "main thread: " << getpid() << endl;
        sleep(1);
    }
    return 0;
}